package net.cyndeline.components.item

import net.cyndeline.AreaType
import net.cyndeline.entitySystem.Component
import net.cyndeline.SingleTarget

/**
 * Specifies what type of area an item can be made to affect
 * when using it at a location on the map.
 */
trait AreaComponent extends Component {
  
  /**
   * The primary area type. Must be specified.
   */
  def area: AreaType
  
  /** Sets a new primary area type. */
  def area_=(newArea: AreaType)
  
  /** Alternative area type, if any. */
  def secondaryArea: Option[AreaType]
  
  /** Sets a new secondary area type. */
  def secondaryArea_=(area: Option[AreaType])
}

class Area extends AreaComponent {
  var area: AreaType = SingleTarget
  var secondaryArea: Option[AreaType] = None
  
  override def copy = {
    val copy = new Area()
    copy.area = area
    copy.secondaryArea = secondaryArea
    copy
  }
}